home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / zoo / lzh.c < prev    next >
C/C++ Source or Header  |  1980-01-02  |  1KB  |  67 lines

  1. /* $Id: lzh.c,v 1.15 91/07/06 19:18:51 dhesi Exp $ */
  2. /*
  3. lzh compression and uncompression interface module
  4. */
  5.  
  6. #include "options.h"
  7. #include "zoo.h"
  8. #include "ar.h"
  9. #include "errors.i"
  10.  
  11. FILE *arcfile;
  12.  
  13. #include "zooio.h"               /* for ZOOFILE */
  14. #include "zoofns.h"              /* for prterror(); */
  15.  
  16. extern char *out_buf_adr;            /* address of buffer */
  17.  
  18. int lzh_encode(infile, outfile)
  19. FILE *infile;
  20. FILE *outfile;
  21. {
  22.     /* extern void encode(); */
  23.     encode(infile, outfile);
  24.     return 0;
  25. }
  26.  
  27. /*
  28. lzh_decode decodes its input and sends it to output.
  29. Should return error status or byte count, but currently
  30. returns 0.
  31. */
  32.  
  33. #undef COUNT_BYTES        /* define for debugging */
  34.  
  35. int lzh_decode(infile, outfile)
  36. FILE *infile;
  37. FILE *outfile;
  38. {
  39.     int n;
  40.     extern int decoded;
  41. #ifdef COUNT_BYTES
  42.     int bytes_decoded = 0;        /*debug*/ /* count bytes after decoding */
  43. #endif
  44.  
  45.     arcfile = infile;                 /* stream to be decoded */
  46.  
  47.     decode_start();
  48.     while (!decoded) {
  49.         n = decode((uint) DICSIZ, (uchar *)out_buf_adr); /* n = count of chars decoded */
  50. #ifdef COUNT_BYTES
  51.         bytes_decoded += n;    /*debug*/
  52. #endif
  53. #ifdef CHECK_BREAK
  54.         check_break();
  55. #endif
  56.         fwrite_crc((uchar *)out_buf_adr, n, outfile);
  57. #ifdef SHOW_DOTS
  58.         (void) putc('.', stderr);
  59.         (void) fflush(stderr);
  60. #endif
  61.     }
  62. #ifdef COUNT_BYTES
  63.     (void) fprintf(stderr, "bytes decoded = %d\n", bytes_decoded);
  64. #endif
  65.     return 0;
  66. }
  67.